
MapEvents = { }

function AddMapEvent( x, y, w, h, func )
	
	table.insert( MapEvents, { w = w, h = h, x = x, y = y, cb = func } );
	
end

function MapEventThink()

	local p = GetPlayer();
	local pos = p:GetCenter();
	
	for k, v in pairs( MapEvents ) do
		
		if( pos.x > v.x and pos.y > v.y and
			pos.x < v.x + v.w and pos.y < v.y + v.h ) then
			
			v.cb();
			
			MapEvents[k] = nil;
			
		end
		
	end
	
end
